<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button onclick="start()">开始</button>
    <button onclick="stop()">停止</button>
    <button onclick="reset()">重置</button>
    <script>
        var e = 0;
        var time_out=null;
        function start() {
            function start_time() {
                var date = new Date(e);
                var minute = date.getMinutes()
                var second = date.getSeconds()
                if (minute <= 9) {
                    minute = "0" + date.getMinutes()
                }
                else {
                    minute = date.getMinutes()
                }
                if (second <= 9) {
                    second = "0" + date.getSeconds()
                }
                else {
                    second = date.getSeconds()
                }
                console.log(minute + ':' + second);
                
                if (e < 12 * 1000) {
                    e += 1000;
                }
                else {
                    clearInterval(time_out);
                }
            }
            var time_out = setInterval(start_time, 1000);
            time=time_out;
        }
        function stop() {
            clearInterval(time);
        }
        function reset() {
            e = 0;
        }
    </script>
</body>

</html>